package com.pavlinic.mylisp;

import org.junit.After;

import com.pavlinic.mylisp.parser.Parser;
import com.pavlinic.mylisp.parser.Tokenizer;

public class LispTestCase {
	private static final Parser PARSER = new Parser(new Tokenizer());

	protected Expression parse(String expression) {
		return PARSER.parse(expression);
	}

	protected ListExpression parseList(String string) {
		return PARSER.parseList(string);
	}
	
	protected Expression eval(String string) {
		return parse(string).evaluate(GlobalEvaluationContext.getInstance());
	}

	@After
	public void clearLispGlobalState() {
		GlobalEvaluationContext.clear();
	}
}